/*
 * TaskQueue.h
 *
 *  Created on: 2012-12-28
 *      Author: yangentao@gmail.com
 */

#pragma once;
#include "../yet/SyncQueue.h"
#include "FtpContext.h"
#include "ITask.h"
#include "Task.h"
namespace ftp {
using namespace yet;

enum TaskOp{
	taskAND,
	taskOR,
};
class TaskQueue: public ITask {
	typedef ITask Super;
public:
	TaskQueue();
	TaskQueue(FtpContext* c, TaskOp taskOp = taskAND);
	virtual ~TaskQueue();
public:
	bool execute();
	void append(boost::shared_ptr<ITask> task);
	Task* appendTask();
	TaskQueue* appendQueue();
public:
	SyncQueue<boost::shared_ptr<ITask> > failedCommands;
	TaskOp taskOp;
private:
	SyncQueue<boost::shared_ptr<ITask> > commands;
};

} /* namespace yet */
